#include<stdio.h>
#include<string.h>

int tong[27];
char line[100];
int main()
{
	scanf("%s", line);
	int len = strlen(line);
	int i;

	for(i=0; i<len; ++i)
		tong[line[i] - 'a'] ++;

	int mx = 0, sit = 0;
	for(i=0; i<26; ++i)
	{
		if(tong[i] > mx)
		{
			mx = tong[i];
			sit = i;
		}
	}
	printf("%c\n%d", sit+'a', mx);

	return 0;
}
